home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Library / Manuels & Misc / Assembly / AOA.ZIP / CH08 / EX8_2A.ASM < prev    next >
Encoding:
Assembly Source File  |  1996-02-07  |  861 b   |  51 lines

  1. ; EX8_2a.asm
  2. ;
  3. ; Example demonstrating the EVEN directive.
  4.  
  5. dseg        segment
  6.  
  7. ; Force an odd location counter within
  8. ; this segment:
  9.  
  10. i        byte    0
  11.  
  12. ; This word is at an odd address, which is bad!
  13.  
  14. j        word    0
  15.  
  16. ; Force the next word to align itself on an
  17. ; even address so we get faster access to it.
  18.  
  19.         even
  20. k        word    0
  21.  
  22. ; Note that even has no effect if we're already
  23. ; at an even address.
  24.  
  25.         even
  26. l        word    0
  27. dseg        ends
  28.  
  29. cseg        segment
  30.         assume    ds:dseg
  31. procedure    proc
  32.         mov    ax, [bx]
  33.         mov     i, al
  34.         mov    bx, ax
  35.  
  36. ; The following instruction would normally lie on
  37. ; an odd address.  The EVEN directive inserts a
  38. ; NOP so that it falls on an even address.
  39.  
  40.         even
  41.         mov    bx, cx
  42.  
  43. ; Since we're already at an even address, the
  44. ; following EVEN directive has no effect.
  45.  
  46.         even
  47.         mov    dx, ax
  48.         ret
  49. procedure    endp
  50. cseg        ends
  51.         end